package com.company.pangu.aliyun.ocr.response;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * <p>身份证识别响应</p >
 *
 * @author youyoukele
 * @version 1.0
 * @date 2023/4/6 下午5:58
 */
@JsonIgnoreProperties(ignoreUnknown = true)
@Data
public class RecognizeIdcardResponse implements Serializable {

    /**
     * algo_version : b8d33b31ac37b5444dbfe791105de25acb0abba5
     * data : {"face":{"algo_version":"b8d33b31ac37b5444dbfe791105de25acb0abba5","angle":0,"data":{"name":"方大呆","sex":"女","ethnicity":"汉","birthDate":"2006年10月2日","address":"上海市西藏南路-瞿溪路弘辉名苑","idNumber":"371002200610020000"},"figure":[{"type":"face","x":284,"y":24,"w":177,"h":213,"box":{"x":371,"y":130,"w":209,"h":172,"angle":89},"points":[{"x":286,"y":27},{"x":457,"y":25},{"x":459,"y":234},{"x":286,"y":230}]}],"ftype":0,"height":307,"orgHeight":307,"orgWidth":483,"prism_keyValueInfo":[{"key":"name","keyProb":100,"value":"方大呆","valuePos":[{"x":82,"y":40},{"x":142,"y":40},{"x":142,"y":60},{"x":82,"y":60}],"valueProb":100},{"key":"sex","keyProb":100,"value":"女","valuePos":[{"x":85,"y":77},{"x":104,"y":77},{"x":104,"y":96},{"x":85,"y":96}],"valueProb":100},{"key":"ethnicity","keyProb":100,"value":"汉","valuePos":[{"x":192,"y":75},{"x":212,"y":75},{"x":212,"y":95},{"x":192,"y":95}],"valueProb":100},{"key":"birthDate","keyProb":100,"value":"2006年10月2日","valuePos":[{"x":76,"y":116},{"x":214,"y":116},{"x":214,"y":131},{"x":76,"y":131}],"valueProb":100},{"key":"address","keyProb":100,"value":"上海市西藏南路-瞿溪路弘辉名苑","valuePos":[{"x":73,"y":154},{"x":278,"y":154},{"x":278,"y":196},{"x":73,"y":196}],"valueProb":100},{"key":"idNumber","keyProb":100,"value":"371002200610020000","valuePos":[{"x":162,"y":256},{"x":379,"y":256},{"x":379,"y":274},{"x":162,"y":274}],"valueProb":100}],"sliceRect":{"x0":0,"y0":0,"x1":482,"y1":0,"x2":483,"y2":307,"x3":0,"y3":307},"warning":{"isCopy":0,"isReshoot":0,"completenessScore":98.645515,"qualityScore":73.324371},"width":483}}
     * height : 307
     * orgHeight : 307
     * orgWidth : 483
     * width : 483
     */

    @JsonProperty("algo_version")
    private String algoVersion;
    @JsonProperty("data")
    private DataX data;
    @JsonProperty("height")
    private int height;
    @JsonProperty("orgHeight")
    private int orgHeight;
    @JsonProperty("orgWidth")
    private int orgWidth;
    @JsonProperty("width")
    private int width;
    
    @Data
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class DataX {
        /**
         * face : {"algo_version":"b8d33b31ac37b5444dbfe791105de25acb0abba5","angle":0,"data":{"name":"方大呆","sex":"女","ethnicity":"汉","birthDate":"2006年10月2日","address":"上海市西藏南路-瞿溪路弘辉名苑","idNumber":"371002200610020000"},"figure":[{"type":"face","x":284,"y":24,"w":177,"h":213,"box":{"x":371,"y":130,"w":209,"h":172,"angle":89},"points":[{"x":286,"y":27},{"x":457,"y":25},{"x":459,"y":234},{"x":286,"y":230}]}],"ftype":0,"height":307,"orgHeight":307,"orgWidth":483,"prism_keyValueInfo":[{"key":"name","keyProb":100,"value":"方大呆","valuePos":[{"x":82,"y":40},{"x":142,"y":40},{"x":142,"y":60},{"x":82,"y":60}],"valueProb":100},{"key":"sex","keyProb":100,"value":"女","valuePos":[{"x":85,"y":77},{"x":104,"y":77},{"x":104,"y":96},{"x":85,"y":96}],"valueProb":100},{"key":"ethnicity","keyProb":100,"value":"汉","valuePos":[{"x":192,"y":75},{"x":212,"y":75},{"x":212,"y":95},{"x":192,"y":95}],"valueProb":100},{"key":"birthDate","keyProb":100,"value":"2006年10月2日","valuePos":[{"x":76,"y":116},{"x":214,"y":116},{"x":214,"y":131},{"x":76,"y":131}],"valueProb":100},{"key":"address","keyProb":100,"value":"上海市西藏南路-瞿溪路弘辉名苑","valuePos":[{"x":73,"y":154},{"x":278,"y":154},{"x":278,"y":196},{"x":73,"y":196}],"valueProb":100},{"key":"idNumber","keyProb":100,"value":"371002200610020000","valuePos":[{"x":162,"y":256},{"x":379,"y":256},{"x":379,"y":274},{"x":162,"y":274}],"valueProb":100}],"sliceRect":{"x0":0,"y0":0,"x1":482,"y1":0,"x2":483,"y2":307,"x3":0,"y3":307},"warning":{"isCopy":0,"isReshoot":0,"completenessScore":98.645515,"qualityScore":73.324371},"width":483}
         */

        @JsonProperty("face")
        private Face face;

        @JsonProperty("back")
        private Back back;

        @Data
        @JsonIgnoreProperties(ignoreUnknown = true)
        public static class Back {
            /**
             * ftype : 0
             * algo_version : adbdfe6d95e774e94e4b0b86b40b194e03807c75
             * data : {"issueAuthority":"厦门市公安局思明分局","validPeriod":"2018.10.02-2038.10.02"}
             * orgWidth : 528
             * sliceRect : {"y0":46,"x0":69,"y1":47,"x1":587,"y2":380,"x2":591,"y3":379,"x3":64}
             * width : 528
             * angle : 0
             * orgHeight : 334
             * prism_keyValueInfo : [{"valuePos":[{"x":281,"y":280},{"x":481,"y":284},{"x":480,"y":306},{"x":281,"y":303}],"keyProb":100,"valueProb":100,"value":"厦门市公安局思明分局","key":"issueAuthority"},{"valuePos":[{"x":280,"y":329},{"x":493,"y":327},{"x":493,"y":346},{"x":280,"y":348}],"keyProb":100,"valueProb":100,"value":"2018.10.02-2038.10.02","key":"validPeriod"}]
             * height : 334
             */
            @JsonProperty("ftype")
            private int ftype;
            @JsonProperty("algo_version")
            private String algo_version;
            @JsonProperty("data")
            private DataEntity data;
            @JsonProperty("orgWidth")
            private int orgWidth;
            @JsonProperty("sliceRect")
            private SliceRectEntity sliceRect;
            @JsonProperty("width")
            private int width;
            @JsonProperty("angle")
            private int angle;
            @JsonProperty("orgHeight")
            private int orgHeight;
            @JsonProperty("prism_keyValueInfo")
            private List<PrismKeyValueInfoEntity> prismKeyValueInfo;
            @JsonProperty("height")
            private int height;

            @lombok.Data
            @JsonIgnoreProperties(ignoreUnknown = true)
            public static class DataEntity {
                /**
                 * issueAuthority : 厦门市公安局思明分局
                 * validPeriod : 2018.10.02-2038.10.02
                 */
                @JsonProperty("issueAuthority")
                private String issueAuthority;
                @JsonProperty("validPeriod")
                private String validPeriod;
            }
            @lombok.Data
            @JsonIgnoreProperties(ignoreUnknown = true)
            public static class SliceRectEntity {
                /**
                 * y0 : 46
                 * x0 : 69
                 * y1 : 47
                 * x1 : 587
                 * y2 : 380
                 * x2 : 591
                 * y3 : 379
                 * x3 : 64
                 */
                @JsonProperty("y0")
                private int y0;
                @JsonProperty("x0")
                private int x0;
                @JsonProperty("y1")
                private int y1;
                @JsonProperty("x1")
                private int x1;
                @JsonProperty("y2")
                private int y2;
                @JsonProperty("x2")
                private int x2;
                @JsonProperty("y3")
                private int y3;
                @JsonProperty("x3")
                private int x3;

            }

            @lombok.Data
            @JsonIgnoreProperties(ignoreUnknown = true)
            public static class PrismKeyValueInfoEntity {
                /**
                 * valuePos : [{"x":281,"y":280},{"x":481,"y":284},{"x":480,"y":306},{"x":281,"y":303}]
                 * keyProb : 100
                 * valueProb : 100
                 * value : 厦门市公安局思明分局
                 * key : issueAuthority
                 */
                @JsonProperty("valuePos")
                private List<PrismKeyValueInfoEntity.ValuePosEntity> valuePos;
                @JsonProperty("keyProb")
                private int keyProb;
                @JsonProperty("valueProb")
                private int valueProb;
                @JsonProperty("value")
                private String value;
                @JsonProperty("key")
                private String key;

                @lombok.Data
                @JsonIgnoreProperties(ignoreUnknown = true)
                public  static class ValuePosEntity {
                    /**
                     * x : 281
                     * y : 280
                     */
                    @JsonProperty("x")
                    private int x;
                    @JsonProperty("y")
                    private int y;

                }
            }
        }

        @Data
        @JsonIgnoreProperties(ignoreUnknown = true)
        public static class Face {
            /**
             * algo_version : b8d33b31ac37b5444dbfe791105de25acb0abba5
             * angle : 0
             * data : {"name":"方大呆","sex":"女","ethnicity":"汉","birthDate":"2006年10月2日","address":"上海市西藏南路-瞿溪路弘辉名苑","idNumber":"371002200610020000"}
             * figure : [{"type":"face","x":284,"y":24,"w":177,"h":213,"box":{"x":371,"y":130,"w":209,"h":172,"angle":89},"points":[{"x":286,"y":27},{"x":457,"y":25},{"x":459,"y":234},{"x":286,"y":230}]}]
             * ftype : 0
             * height : 307
             * orgHeight : 307
             * orgWidth : 483
             * prism_keyValueInfo : [{"key":"name","keyProb":100,"value":"方大呆","valuePos":[{"x":82,"y":40},{"x":142,"y":40},{"x":142,"y":60},{"x":82,"y":60}],"valueProb":100},{"key":"sex","keyProb":100,"value":"女","valuePos":[{"x":85,"y":77},{"x":104,"y":77},{"x":104,"y":96},{"x":85,"y":96}],"valueProb":100},{"key":"ethnicity","keyProb":100,"value":"汉","valuePos":[{"x":192,"y":75},{"x":212,"y":75},{"x":212,"y":95},{"x":192,"y":95}],"valueProb":100},{"key":"birthDate","keyProb":100,"value":"2006年10月2日","valuePos":[{"x":76,"y":116},{"x":214,"y":116},{"x":214,"y":131},{"x":76,"y":131}],"valueProb":100},{"key":"address","keyProb":100,"value":"上海市西藏南路-瞿溪路弘辉名苑","valuePos":[{"x":73,"y":154},{"x":278,"y":154},{"x":278,"y":196},{"x":73,"y":196}],"valueProb":100},{"key":"idNumber","keyProb":100,"value":"371002200610020000","valuePos":[{"x":162,"y":256},{"x":379,"y":256},{"x":379,"y":274},{"x":162,"y":274}],"valueProb":100}]
             * sliceRect : {"x0":0,"y0":0,"x1":482,"y1":0,"x2":483,"y2":307,"x3":0,"y3":307}
             * warning : {"isCopy":0,"isReshoot":0,"completenessScore":98.645515,"qualityScore":73.324371}
             * width : 483
             */

            @JsonProperty("algo_version")
            private String algoVersion;
            @JsonProperty("angle")
            private int angle;
            @JsonProperty("data")
            private Data data;
            @JsonProperty("ftype")
            private int ftype;
            @JsonProperty("height")
            private int height;
            @JsonProperty("orgHeight")
            private int orgHeight;
            @JsonProperty("orgWidth")
            private int orgWidth;
            @JsonProperty("sliceRect")
            private SliceRect sliceRect;
            @JsonProperty("warning")
            private Warning warning;
            @JsonProperty("width")
            private int width;
            @JsonProperty("figure")
            private List<Figure> figure;
            @JsonProperty("prism_keyValueInfo")
            private List<PrismKeyValueInfo> prismKeyValueInfo;

            @lombok.Data
            @JsonIgnoreProperties(ignoreUnknown = true)
            public static class Data {
                /**
                 * name : 方大呆
                 * sex : 女
                 * ethnicity : 汉
                 * birthDate : 2006年10月2日
                 * address : 上海市西藏南路-瞿溪路弘辉名苑
                 * idNumber : 371002200610020000
                 */

                @JsonProperty("name")
                private String name;
                @JsonProperty("sex")
                private String sex;
                @JsonProperty("ethnicity")
                private String ethnicity;
                @JsonProperty("birthDate")
                private String birthDate;
                @JsonProperty("address")
                private String address;
                @JsonProperty("idNumber")
                private String idNumber;
                
            }

            @lombok.Data
            @JsonIgnoreProperties(ignoreUnknown = true)
            public static class SliceRect {
                /**
                 * x0 : 0
                 * y0 : 0
                 * x1 : 482
                 * y1 : 0
                 * x2 : 483
                 * y2 : 307
                 * x3 : 0
                 * y3 : 307
                 */

                @JsonProperty("x0")
                private int x0;
                @JsonProperty("y0")
                private int y0;
                @JsonProperty("x1")
                private int x1;
                @JsonProperty("y1")
                private int y1;
                @JsonProperty("x2")
                private int x2;
                @JsonProperty("y2")
                private int y2;
                @JsonProperty("x3")
                private int x3;
                @JsonProperty("y3")
                private int y3;

            }

            @lombok.Data
            @JsonIgnoreProperties(ignoreUnknown = true)
            public static class Warning {
                /**
                 * isCopy : 0
                 * isReshoot : 0
                 * completenessScore : 98.645515
                 * qualityScore : 73.324371
                 */

                @JsonProperty("isCopy")
                private int isCopy;
                @JsonProperty("isReshoot")
                private int isReshoot;
                @JsonProperty("completenessScore")
                private double completenessScore;
                @JsonProperty("qualityScore")
                private double qualityScore;
             
            }

            @lombok.Data
            @JsonIgnoreProperties(ignoreUnknown = true)
            public static class Figure {
                /**
                 * type : face
                 * x : 284
                 * y : 24
                 * w : 177
                 * h : 213
                 * box : {"x":371,"y":130,"w":209,"h":172,"angle":89}
                 * points : [{"x":286,"y":27},{"x":457,"y":25},{"x":459,"y":234},{"x":286,"y":230}]
                 */

                @JsonProperty("type")
                private String type;
                @JsonProperty("x")
                private int x;
                @JsonProperty("y")
                private int y;
                @JsonProperty("w")
                private int w;
                @JsonProperty("h")
                private int h;
                @JsonProperty("box")
                private Box box;
                @JsonProperty("points")
                private List<Points> points;

                @lombok.Data
                @JsonIgnoreProperties(ignoreUnknown = true)
                public static class Box {
                    /**
                     * x : 371
                     * y : 130
                     * w : 209
                     * h : 172
                     * angle : 89
                     */

                    @JsonProperty("x")
                    private int x;
                    @JsonProperty("y")
                    private int y;
                    @JsonProperty("w")
                    private int w;
                    @JsonProperty("h")
                    private int h;
                    @JsonProperty("angle")
                    private int angle;
                  
                }

                @lombok.Data
                @JsonIgnoreProperties(ignoreUnknown = true)
                public static class Points {
                    /**
                     * x : 286
                     * y : 27
                     */

                    @JsonProperty("x")
                    private int x;
                    @JsonProperty("y")
                    private int y;
 
                }
            }

            @lombok.Data
            @JsonIgnoreProperties(ignoreUnknown = true)
            public static class PrismKeyValueInfo {
                /**
                 * key : name
                 * keyProb : 100
                 * value : 方大呆
                 * valuePos : [{"x":82,"y":40},{"x":142,"y":40},{"x":142,"y":60},{"x":82,"y":60}]
                 * valueProb : 100
                 */

                @JsonProperty("key")
                private String key;
                @JsonProperty("keyProb")
                private int keyProb;
                @JsonProperty("value")
                private String value;
                @JsonProperty("valueProb")
                private int valueProb;
                @JsonProperty("valuePos")
                private List<ValuePos> valuePos;

                @lombok.Data
                @JsonIgnoreProperties(ignoreUnknown = true)
                public static class ValuePos {
                    /**
                     * x : 82
                     * y : 40
                     */

                    @JsonProperty("x")
                    private int x;
                    @JsonProperty("y")
                    private int y;
                }
            }
        }
    }
}
